﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sharp.Portal.ExtNet.Provider;
using Sharp.Portal.Mvc.List;

namespace Sharp.Portal.ExtNet
{
    /// <summary>
    /// 树形列表页实现
    /// </summary>
    public partial class ExtSharpTreeList :  SharpTreeList
    {
        /// <summary>
        /// 树形列表页实现
        /// </summary>
        public ExtSharpTreeList() : base()
        {
            Listeners = new Dictionary<string, string>();
        }
        /// <summary>
        /// 侦听器
        /// </summary>
        public Dictionary<string, string> Listeners { get; set; }
        /// <summary>
        /// 初始化完成
        /// </summary>
        public override void InitComplete()
        {
            base.InitComplete();

            this.Listeners.Add("ItemDblClick", "App.Grid.OnModuleGridItemDblClick");
            this.Listeners.Add("ItemClick", "App.Grid.DoGridItemClick");
            this.Listeners.Add("ColumnHide", "App.Grid.HideColumn");
            this.Listeners.Add("ColumnResize", "App.Grid.ResizeColumn");
            this.Listeners.Add("ColumnMove", "App.Grid.MoveColumn");
            this.Listeners.Add("ColumnShow", "App.Grid.ShowColumn");
            //this.Listeners.Add("SortChange", "App.Grid.ChangeSort");//界面上有排序字段显示就会提示已经排序
        }

        /// <summary>
        /// 自动全部展开
        /// </summary>
        public Boolean Expand { get; set; }


        /// <summary>
        /// 根节点树识别字段值，用于组织树结构
        /// 默认为 null；如果根字段值不同，则在构造函数中手动指定
        /// </summary>
        public Guid? RootParentValue { get; set; }

        /// <summary>
        /// 带选择框
        /// </summary>
        public Boolean CheckTree { get; set; }
        /// <summary>
        /// 显示根节点
        /// </summary>
        public bool RootVisible { get; set; }
        /// <summary>
        /// 初始化适配器
        /// </summary>
        public override void InitProvider()
        {
            if (this.Provider == null)
                this.Provider = new ListTreePage();

        }
    }
}
